#pragma once
#ifndef PARTICLESYSTEM_H
#define PARTICLESYSTEM_H

#include <tsg.h>
using namespace tsg;
using namespace controller;
using namespace gl;

#define NUMBER_OF_ELEMENT_PER_PARTICLE 8

class CEmitter;
class CSimulation;
class CReaper;

class CParticleSystem : public Controller<float*>
{
public:
	Parameter<float> m_time;
	//Parameter<float> m_applicationTime;
	float m_eulerStep; 
	float m_timePreviousEulerStep;

	//i= positionX, i+1=positionY, i+2=positionZ, i+3=velocityX, i+4=velocityY, i+5=velocityZ, i+6=birthTime, i+7=isAlive
	float* m_arrayOfParticles;
	int m_numberOfParticle;

	//pointer to the emitter, simulator and reaper of the particle system
	CEmitter* m_pointerEmitter;
	CSimulation* m_pointerSimulation;
	CReaper* m_pointerReaper;

public:
	CParticleSystem(int numberOfElement);
	~CParticleSystem(void);
	
private:
	void doUpdate();
};

#endif